	
	'
	'  unpack - simple tool for unpacking packages
	'
	'  compile with fbc -s console unpack.bas
	'
	
	#Include "fbpacker.bi"
	
	Dim As Integer 	userInput
	Dim As String		password, inputFile
	Dim As FB.Packer	package
	
	Do
	
		Cls
		
		Print
		Input " enter package filename: ", inputFile
		Input " enter password: ", password
		
		If package.Load(inputFile, password) Then
			
			For i As Integer = 0 To package.ItemCount - 1
				
				With package.Item(i)[0]
					
					package.ExtractFile .Name, "_" + .Name
					
				End With
				
			Next
			
		EndIf
		
		Print
		Print " What you want to do now:"
		Print
		Print "  [1] Unpack more packages!"
		Print "  [anything else] Exit"
		Print
		Input "> ", userInput
		
		package.Clear
		
		If userInput = 1 Then Continue Do
		
		Exit Do
	
	Loop
	